import com.mahees.portfolio.*;
import com.mahees.portfolio.domain.*;

class BootStrap {

	def init = { servletContext -> loadTools() }
	def destroy = {
	}

	def loadTools() {
		[
					(DevelopmentToolTypeEnum.FRAMEWORK) : [
						[name : 'Ruby on Rails', url : 'http://rubyonrails.org/', logo : 'rails.jpg', showName : true],
						[name : 'Backbone MVC JS', url : 'http://documentcloud.github.com/backbone/', logo : 'backbone.png', showName : true],
						[name : 'Underscore JS', url : 'http://documentcloud.github.com/underscore/', logo : 'underscore.png'],
						[name : 'jQuery', url : 'http://jquery.com/', logo : 'jquery.png'],
						[name : 'jQuery Mobile', url : 'http://jquerymobile.com/', logo : 'jquery-mobile.png'],
						[name : 'Less CSS', url : 'http://lesscss.org/', logo : 'less-css.png', showName : true],
						[name : 'Phone Gap', url : 'http://phonegap.com/', logo : 'phonegap.png'],
						[name : 'Grails', url : 'http://grails.org/', logo : 'grails_logo.png'],
						[name : 'Liquibase', url : 'http://www.liquibase.org/', logo :  'liquibase_logo.gif'],
						[name : 'Hibernate', url : 'http://www.hibernate.org/', logo : 'hibernate.png'],
						[name : 'Spring Framework', url : 'http://www.springsource.org/', logo : 'spring.png', showName : true],
						[name : 'ASP.net', url : 'http://www.asp.net/', logo : 'asp.net-logo.gif'],
						[name : 'ASP.net MVC', url : 'http://www.asp.net/mvc', logo : 'asp_dotnet_mvc_logo.png'],
						[name : 'ADO.NET Entity Framework', url : 'http://www.asp.net/entity-framework', logo : 'entity-framework.jpg'],
						[name : 'Rhino Mocks', url : 'http://ayende.com/wiki/Rhino+Mocks.ashx', logo : 'rhinomocks_logo.png'],
						[name : 'NUnit', url : 'http://www.nunit.org/', logo : 'NUnit-logo.png'],
					],
					(DevelopmentToolTypeEnum.LANGUAGE) : [
						[name : 'Groovy', url : 'http://groovy.codehaus.org/', logo : 'groovy-logo.png'],
						[name : 'Ruby', url : 'http://www.ruby-lang.org/', logo : 'ruby-logo.png', showName : true],
						[name : 'PHP', url : 'http://www.php.net/', logo : 'php-logo.png'],
						[name : 'Java', url : 'http://www.oracle.com/technetwork/java/javase/downloads/index.html', logo : 'java-logo.jpg'],
						[name : 'CSS', url : 'http://google.com', logo : ''],
						[name : 'HTML', url : 'http://google.com', logo : ''],
						[name : 'C#', url : 'http://msdn.microsoft.com/en-us/library/aa287558(v=vs.71).aspx', logo : 'csharp-logo.gif'],
						[name : 'Javascript', url : 'http://google.com', logo : ''],
					],
					(DevelopmentToolTypeEnum.PLATFORM) : [
						[name : 'Microsoft Azure', url : 'http://www.windowsazure.com/', logo : 'azure-logo.png'],
						[name : 'Cloud Foundry', url : 'http://cloudfoundry.com/', logo : 'cloud-foundry-logo.png'],
						[name : 'Google App Engine', url : 'https://appengine.google.com/', logo : 'google-app-engine-logo.png'],
						[name : 'Ubuntu', url : 'http://www.ubuntu.com/', logo : 'Ubuntu-logo.gif', showName : true],
						[name : 'Debian', url : 'http://www.debian.org/', logo : 'debian-logo.jpg'],
						[name : 'FreeBSD', url : 'http://www.freebsd.org/', logo : 'the-freebsd-foundation.gif', showName : true],
						[name : 'CentOS', url : 'http://www.centos.org/', logo : 'centos.png'],
						[name : 'Windows', url : 'http://windows.microsoft.com', logo : 'windows.jpg', showName : true],
					],
					(DevelopmentToolTypeEnum.IDE) : [
						[name : 'Visual Studio', url : 'http://msdn.microsoft.com/en-us/vstudio/aa718325', logo : 'mvs.jpg'],
						[name : 'Springsource Tool Suite', url : 'http://www.springsource.com/developer/sts', logo : 'sts.png', showName : true],
						[name : 'Eclipse', url : 'http://www.eclipse.org/', logo : 'eclipse_logo.jpg'],
						[name : 'Netbeans', url : 'http://netbeans.org/', logo : 'netbeans-logo.png', showName : true]
					],
					(DevelopmentToolTypeEnum.OTHER) : [
						[name : 'SVN', url : 'http://msdn.microsoft.com/en-us/vstudio/aa718325', logo : ''],
						[name : 'GIT', url : 'http://www.springsource.com/developer/sts', logo : ''],
						[name : 'Apache', url : 'http://www.eclipse.org/', logo : ''],
						[name : 'Apache Tomcat', url : 'http://netbeans.org/', logo : ''],
						[name : 'MySQL', url : 'http://netbeans.org/', logo : ''],
						[name : 'PosgreSQL', url : 'http://netbeans.org/', logo : ''],
						[name : 'SQL Server', url : 'http://netbeans.org/', logo : ''],
						[name : 'Tomato', url : 'http://netbeans.org/', logo : ''],
						[name : 'DDWRT', url : 'http://netbeans.org/', logo : ''],
						[name : 'OpenWRT', url : 'http://netbeans.org/', logo : ''],
					]
				].each { toolType, tools ->
					tools.each { tool ->
						File logoFile = (tool.logo) ?
								new FSFile(
								webLocation : tool.logo
								).save(failOnError : true) : null

						DevelopmentTool developmentTool = new DevelopmentTool(
								toolType : toolType,
								name : tool.name,
								url : tool.url,
								logo : logoFile
								)
						!tool.showName ?: (developmentTool.showName = tool.showName) 
						developmentTool.save(failOnError : true);
					}
				}
				
				/*
					'Web' => array (
array('name' => 'Nurse Visit Management Application'),
array('name' => 'Loans & Insurance Management System'),
array('name' => 'Health Portfolio'),
array('name' => 'Doctor and Hospital Locator'),
array('name' => 'Cloud Computing Application')
),
	'Mobile' => array(
array('name' => 'Fitness Tracker'),
)
);
$personalProjects = array(
array('name' => 'Drumstick'),
array('name' => 'Server in a drawer')
);
				*/
	};
}

